package com.foton.mybatis.configration;

import com.foton.mybatis.model.MappedStatement;
import com.foton.mybatis.model.MapperRegistry;
import com.foton.mybatis.model.Properties;
import com.foton.mybatis.session.DefaultSqlSession;
import com.foton.mybatis.session.SqlSession;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author RenPu
 * @Date 2023/3/29 15:56
 * @Version 1.0
 * @Description:
 **/
public class Configration {

    /**
     * 配置项
     */
    public static Properties propertise=new Properties();


    /**
     * mapper注册器
     */
    protected final MapperRegistry mapperRegistry=new MapperRegistry();


    protected final Map<String, MappedStatement> mappedStatement=new HashMap<>();

    public static String getProperty(String dbDriverConf) {

     return "";
    }


    public void addMapperedStatment(String sqlId, MappedStatement statement) {

        this.mappedStatement.put(sqlId,statement);
    }

    public <T> void addMapper(Class<T> type) {
        this.mapperRegistry.addMapper(type);
    }

    public MappedStatement getMappedStatement(String sqlId) {

        return new MappedStatement();
    }

    public <T> T getMapper(Class<T> type, SqlSession sqlSession) {
        return (T) this.mapperRegistry.getMapper(type,sqlSession);
    }
}
